package hongcaosp.app.android.modle.impl;

import android.text.TextUtils;
import android.util.Log;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;

import hongcaosp.app.android.BuildConfig;
import hongcaosp.app.android.modle.BaseResponse;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.bean.RecommendList;
import hongcaosp.app.android.modle.mi.VideoModle;
import hongcaosp.app.android.modle.bean.Pagebean;
import hongcaosp.app.android.modle.bean.SignBean;
import hongcaosp.app.android.modle.bean.Video;

public class VideoModleImpl implements VideoModle {
    @Override
    public void recommendVideo(String token, DataCallBack<RecommendList> dataCallBack) {
        HttpParams params = new HttpParams();
        if (!TextUtils.isEmpty(token)) {
            params.put("token", token);
        }
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/recommendVideo").params(params).execute(dataCallBack);
    }

    @Override
    public void videoSign(String token, DataCallBack<SignBean> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/videos/videoSign").params(params).execute(dataCallBack);
    }

    @Override
    public void releaseVideos(String token, String content, String videoPath, float videoSeconds, int videoWidth, int videoHeight, String coverPath, DataCallBack callBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("content", content);
        params.put("videoPath", videoPath);
        params.put("videoSeconds", videoSeconds);
        params.put("videoWidth", videoWidth);
        params.put("videoHeight", videoHeight);
        params.put("coverPath", coverPath);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/videos/releaseVideos").params(params).execute(callBack);

    }

    @Override
    public void videoForward(String token, String content, int id, DataCallBack callBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("content", content);
        params.put("id", id);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/videos/videosForward").params(params).execute(callBack);
    }

    @Override
    public void playCount(int id) {
        HttpParams params = new HttpParams();
        params.put("id", id);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/playCount").params(params).execute(new DataCallBack() {
            @Override
            public void onFail(int code, String errorMessage) {
                super.onFail(code, errorMessage);
            }
        });
    }
}
